#include <iostream>
#include <cstdio>
#include <climits>
using namespace std;
#include <vector>

class Solution {
public:
    vector<int> singleNumber(vector<int>& nums) {
        vector<int> ret(2, 0);
        int xor_num = 0;
        for(auto& x : nums) xor_num ^= x;

        int low_bit = (xor_num == INT_MIN) ? INT_MIN : (xor_num & (-xor_num));
        for(auto& x : nums){
            if(x & low_bit) ret[1] ^= x;
            else ret[0] ^= x;
        }
        return ret;
    }
};